@import '../basic/globalVar.scss';
@import '../mixins/index.scss';
@mixin tabSize($size) {
  $font-size: $--font-size-default;
  $nav-item-wrap-margin-right: 12px;
  $nav-item-padding-horizontal: 16px;
  $nav-item-padding-vertical: 8px;
  @if ($size == mini) {
    $font-size: $--font-size-mini;
    $nav-item-wrap-margin-right: 4px;
    $nav-item-padding-horizontal: 12px;
    $nav-item-padding-vertical: 4px;
  } @else if ($size == small) {
    $font-size: $--font-size-small;
    $nav-item-wrap-margin-right: 8px;
    $nav-item-padding-horizontal: 14px;
    $nav-item-padding-vertical: 6px;
  } @else if ($size == large) {
    $font-size: $--font-size-large;
    $nav-item-wrap-margin-right: 16px;
    $nav-item-padding-horizontal: 16px;
    $nav-item-padding-vertical: 8px;
  }
  @include el(header, false) {
    font-size: $font-size;
  }
  @include el(nav-item-wrap, false) {
    margin-right: $nav-item-wrap-margin-right;
    & > {
      @include el(nav-item, false) {
        padding: $nav-item-padding-vertical $nav-item-padding-horizontal;
      }
    }
    &:nth-last-of-type(1) {
      margin: 0;
    }
  }
}
@include classNameConnect(tabs) {
  width: 100%;
  @include el(header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: $--border-default;
  }
  @include el(nav-wrap) {
    flex: 1;
    width: 100%;
    margin-bottom: -1px;
  }
  @include el(nav) {
    display: inline-block;
    white-space: nowrap;
  }
  @include el(nav-item-wrap) {
    display: inline-block;
    cursor: pointer;
    position: relative;

    @include when(active) {
      & > {
        @include el(nav-item, false) {
          color: $--color-primary;
          border-bottom: 2px solid $--color-primary;
        }
      }
    }
    @include when(disabled) {
      cursor: not-allowed;
      & > {
        @include el(nav-item, false) {
          opacity: $--opacity-disabled;
        }
      }
    }

    &:not(.is-disabled):hover {
      color: $--color-primary;
    }
  }
  @include el(nav-item) {
    background-color: $--color-white;
    border-top-left-radius: $--border-radius-default;
    border-top-right-radius: $--border-radius-default;
  }
  @include el(nav-item-name) {
    display: inline-block;
  }
  @include el(close) {
    margin-left: 10px;
    vertical-align: middle;
    color: $--color-text-default;
    line-height: normal;

    &:hover {
      color: $--color-text-title;
    }
  }
  @include el(extra) {
  }

  @include b(left) {
    @include el(nav-wrap, false) {
      align-items: flex-start;
      order: 0;
    }
    @include el(extra, false) {
      align-items: flex-end;
      order: 1;
    }
  }
  @include b(center) {
    @include el(nav-wrap, false) {
      align-items: center;
      order: 0;
      text-align: center;
    }
    @include el(extra, false) {
      align-items: flex-end;
      order: 1;
    }
  }
  @include b(right) {
    @include el(nav-wrap, false) {
      align-items: flex-end;
      order: 1;
      text-align: right;
    }
    @include el(extra, false) {
      align-items: flex-start;
      order: 0;
    }
  }

  @include el(wrap) {
    overflow: hidden;
    background-color: $--color-white;
  }
  @include el(content) {
    display: flex;
  }
  @include el(content-animation) {
    transition: all $--animation-time;
  }

  @include b(mini) {
    @include tabSize(mini);
  }

  @include b(small) {
    @include tabSize(small);
  }

  @include b(default) {
    @include tabSize(default);
  }

  @include b(large) {
    @include tabSize(large);
  }

  @include b(card) {
    @include el(nav-item-wrap, false) {
      margin-right: 4px;
      & > {
        @include el(nav-item, false) {
          border-top: $--border-default;
          border-left: $--border-default;
          border-right: $--border-default;
          border-top-left-radius: $--border-radius-default;
          border-top-right-radius: $--border-radius-default;
          position: relative;
          bottom: -1px;
          left: 0;
        }
      }
      @include when(active) {
        & > {
          @include el(nav-item, false) {
            border-bottom: 2px solid $--color-white;
          }
        }
        &:after {
          content: '';
          position: absolute;
          bottom: -1px;
          left: 0;
          width: 100%;
          border-bottom: 2px solid $--color-white;
        }
      }
    }
  }
  @include b(border) {
    @include el(wrap, false) {
      border-left: $--border-default;
      border-right: $--border-default;
      border-bottom: $--border-default;
    }
  }
}
@include classNameConnect(tab-content) {
  width: 100%;
  padding: 16px;
  flex-shrink: 0;
  background-color: $--color-white;
}
